package com.design.ObserverMode.mode;

import com.design.ObserverMode.demo.User;

public class UserReg {

    /**
     * 注册，保存用户信息
     * @param user
     */
    private void saveUser(User user){
        System.out.println("将用户信息保存到数据库中，注册成功！");
    }

    public void reg(User user){
        //注册
        saveUser(user);
        RegSubject regSubject = new MyRegSubject();
        regSubject.reg(new MsgNotificationObserver());
        regSubject.reg(new LimitVipObserver());
        regSubject.reg(new PhoneRegionObserver());
        regSubject.notifyAll(user);
    }

}
